<template>
  <el-container>
    <el-header>
      <div class="left_header">
        <div class="logo">
          <img src="@/assets/xdy3.png" class="sidebar-logo" />
        </div>
        <div class="logo_text">
          <span class="title">{{ title }}</span>
        </div>
      </div>
      <el-menu
        :default-active="activeIndex"
        class="el-menu-demo"
        mode="horizontal"
        @select="handleSelect"
        style="float: right; margin-right: 300px"
      >
        <el-menu-item index="1" class="tab">首页</el-menu-item>
        <el-menu-item index="2" class="tab">产品文档</el-menu-item>
        <el-menu-item index="3" class="tab">产品下载</el-menu-item>
        <el-menu-item index="4" class="tab">常见问题</el-menu-item>
      </el-menu>
    </el-header>
    <div
      style="height: 1px; background: #d9dadc; opacity: 1; margin-top: 20px"
    ></div>
    <el-container class="maincontent">
      <el-aside class="aside_left">
        <div class="aside_left_tree">
          <div class="filter-container">
            <el-input
              v-model="listQuery.title"
              placeholder="请输入查询内容"
              style="width: 280px; position: relative; right: -20px; top: -50px"
              suffix-icon="el-icon-search"
              @keyup.enter.native="seachhandleFilter"
              @click="seachhandleFilter"
            >
            </el-input>
          </div>
          <!--左边菜单-->
          <div
            style="position: relative; top: -60px; right: -24px; top: -110px"
          >
            <el-menu default-active="2" class="el-menu-vertical-demo">
              <el-submenu
                :index="p.sort"
                v-for="p in ProductDocTyp"
                :key="p.sort"
              >
                <template slot="title">
                  <!-- <div ></div>-->
                  <span
                    @click="
                      p.subproductDocTypTreeDTOs.length <= 0 && p.prtID == ''
                        ? elmenuitemClick2(p)
                        : elmenuitemClick(p)
                    "
                    >{{ p.name }}</span
                  >
                </template>
                <el-menu-item-group
                  :index="sub.sort"
                  v-for="sub in p.subproductDocTypTreeDTOs"
                  :key="sub.sort"
                >
                  <el-menu-item
                    :index="sub.sort"
                    @click="elmenuitemClick(sub)"
                    >{{ sub.name }}</el-menu-item
                  >
                </el-menu-item-group>
              </el-submenu>
            </el-menu>
          </div>
          <!--左边菜单-->
        </div>
      </el-aside>
      <el-main>
        <div v-html="ProductDoc" style="padding: 38px 10px 0px 50px;"></div>
      </el-main>
    </el-container>
  </el-container>
</template>
<script>
import { validUsername } from "@/utils/validate";
import Vue from "vue";
import { debuglog } from "util";
import { Ajax, AjaxToken } from "@/api/common";
import { Login } from "@/api/login/login";
import "url-search-params-polyfill";
export default {
  //初始化
  created() {
    var params = new URLSearchParams();
    params.append("PosTyp", 0);
    backstage.GetAllProductDocTyp(this, params);
  },
  data() {
    return {
      ProductDocTyp: [],
      ProductDoc: "",
      activeIndex: "2",
      title: "支付策略平台",
      listQuery: {
        title: "",
        total: 0,
        page: 1,
        limit: 10,
      },
    };
  },
  methods: {
    handleSelect(key, keyPath) {
      if (key == "1") {
        this.$router.push({ path: "/login" });
      }
      if (key == "2") {
        this.$router.push({ path: "/Product" });
      }
      if (key == "4") {
        this.$router.push({ path: "/FAQ" });
      }
    },
    elmenuitemClick(sub) {
      var params = new URLSearchParams();
      params.append("TypID", sub.typID);
      backstage.GetProductDocTyp(this, params);
    },
    elmenuitemClick2(sub) {},
    seachhandleFilter() {
      var params = new URLSearchParams();
      params.append("Name", this.listQuery.title);
      params.append("PosTyp", 0);
      backstage.GetAllProductDocTyp(this, params);
    },
  },
};
//后台事件
var backstage = {
  // 获取Heartbeat集合
  GetAllProductDocTyp: function (thisobj, params) {
    Ajax(
      thisobj,
      "GetAllProductDocTypLst",
      params,
      "post",
      function (res) {
        var body = res.data.data;
         if (body.length <= 0) {
          thisobj.$message({
            showClose: true,
            message: "未查询到满足条件的数据",
            type: "warning",
            duration: 3000,
          });
        }
        thisobj.ProductDocTyp = body;
        thisobj.ProductDoc = body[0].subproductDocTypTreeDTOs[0].content;
      },
      function (err) {}
    );
  },
  //
  GetProductDocTyp: function (thisobj, params) {
    Ajax(
      thisobj,
      "GetDesList",
      params,
      "post",
      function (res) {
        thisobj.ProductDoc="";
        var body = res.data.data[0];
        thisobj.ProductDoc = body.content;
      },
      function (err) {}
    );
  },
};
</script>

<style lang="scss" scoped>
$bg: #283443;
$light_gray: #fff;
$cursor: #000;

@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
  .login-container .el-input input {
    color: $cursor;
  }
}

.maincontent {
}
.aside_left {
  width: 600px !important;
  border-right: 1px solid #eeeeee;
  opacity: 1;
}
.aside_left_tree {
  float: right;
}

/* reset element-ui css */
.login-container {
  .el-input {
    display: inline-block;
    height: 47px;
    width: 85%;

    input {
      background: transparent;
      border: 0px;
      -webkit-appearance: none;
      border-radius: 0px;
      padding: 12px 5px 12px 15px;
      color: black;
      height: 47px;
      caret-color: $cursor;

      &:-webkit-autofill {
        box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-text-fill-color: $cursor !important;
      }
    }
  }

  .el-form-item {
    //background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    color: black;
    top: -100px;
    position: relative;
    width: 286px;
    height: 45px;
    background: #ffffff;
    border: 1px solid #eeeeee;
    //opacity: 1;
  }
}
.login_button {
  margin-bottom: 30px;
  top: -120px;
  position: relative;
  width: 286px;
  height: 45px;
  background: #409eff;
  opacity: 1;
  left: -12px;
}
.background {
  width: 100%;
  height: 100%; /**宽高100%是为了图片铺满屏幕 */
  z-index: -1;
  position: absolute;
  left: 0px;
  top: 80px;
}

.front {
  z-index: 1;
  position: absolute;
}
.left_header {
  margin-left: 220px;
}

.logo_text {
  float: left;
  line-height: 70px;
  margin-left: 30px;
}
.logo_text .title {
  width: 120px;
  height: 20px;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #333333;
  opacity: 1;
}
.tab {
  margin-left: 45px !important;
  margin-right: 45px !important;
}
.logain_tab {
  margin-left: 30px !important;
  margin-right: 30px !important;
}
.login_type {
  position: relative;
  top: -160px;
}
.logo {
  float: left;
}
.logo img {
  position: relative;
  top: 15px;
}
.el-header,
.el-footer {
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  color: #333;
  text-align: center;
  line-height: 200px;
}
.el-main {
  color: #333;

}
aside {
  background: #ffffff;
}
.el-submenu .el-menu-item {
  padding-right: 160px;
  text-align: left;
}
</style>
<style  >
.el-submenu div {
  padding-right: 232px;
  font-size: 14px;
  font-family: Source Han Sans CN;
  font-weight: 500;
  color: #444444;
  opacity: 1;
}
.el-submenu div:hover {
}
.aside_left_tree .filter-container .el-input--medium .el-input__inner {
  height: 36px;
  line-height: 36px;
  height: 40px;
  border: 1px solid #c3cad2;
  opacity: 1;
  border-radius: 24px;
}
</style>